package com.moxiao.yfjh.module.blind.dal.mysql.memberReport;

import com.moxiao.yfjh.module.blind.controller.admin.memberReport.vo.MemberReportExportReqVO;
import com.moxiao.yfjh.module.blind.controller.admin.memberReport.vo.MemberReportPageReqVO;
import java.util.*;

import com.moxiao.yfjh.framework.common.pojo.PageResult;
import com.moxiao.yfjh.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.moxiao.yfjh.framework.mybatis.core.mapper.BaseMapperX;
import com.moxiao.yfjh.module.blind.dal.dataobject.memberReport.MemberReportDO;
import org.apache.ibatis.annotations.Mapper;
import com.moxiao.yfjh.module.blind.controller.admin.memberReport.vo.*;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 相亲交友举报 Mapper
 *
 * @author mx
 */
@Mapper
public interface MemberReportMapper extends BaseMapperX<MemberReportDO> {

    default PageResult<MemberReportDO> selectPage(MemberReportPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MemberReportDO>()
                .eqIfPresent(MemberReportDO::getNo, reqVO.getNo())
                .eqIfPresent(MemberReportDO::getReportId, reqVO.getReportId())
                .likeIfPresent(MemberReportDO::getReportName, reqVO.getReportName())
                .eqIfPresent(MemberReportDO::getQuiltReport, reqVO.getQuiltReport())
                .likeIfPresent(MemberReportDO::getQuiltName, reqVO.getQuiltName())
                .betweenIfPresent(MemberReportDO::getSubmitTime, reqVO.getSubmitTime())
                .eqIfPresent(MemberReportDO::getReason, reqVO.getReason())
                .eqIfPresent(MemberReportDO::getContent, reqVO.getContent())
                .eqIfPresent(MemberReportDO::getEvidenceImg, reqVO.getEvidenceImg())
                .eqIfPresent(MemberReportDO::getEvidenceVideo, reqVO.getEvidenceVideo())
                .eqIfPresent(MemberReportDO::getMobile, reqVO.getMobile())
                .eqIfPresent(MemberReportDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(MemberReportDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MemberReportDO::getId));
    }

    default List<MemberReportDO> selectList(MemberReportExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<MemberReportDO>()
                .eqIfPresent(MemberReportDO::getNo, reqVO.getNo())
                .eqIfPresent(MemberReportDO::getReportId, reqVO.getReportId())
                .likeIfPresent(MemberReportDO::getReportName, reqVO.getReportName())
                .eqIfPresent(MemberReportDO::getQuiltReport, reqVO.getQuiltReport())
                .likeIfPresent(MemberReportDO::getQuiltName, reqVO.getQuiltName())
                .betweenIfPresent(MemberReportDO::getSubmitTime, reqVO.getSubmitTime())
                .eqIfPresent(MemberReportDO::getReason, reqVO.getReason())
                .eqIfPresent(MemberReportDO::getContent, reqVO.getContent())
                .eqIfPresent(MemberReportDO::getEvidenceImg, reqVO.getEvidenceImg())
                .eqIfPresent(MemberReportDO::getEvidenceVideo, reqVO.getEvidenceVideo())
                .eqIfPresent(MemberReportDO::getMobile, reqVO.getMobile())
                .eqIfPresent(MemberReportDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(MemberReportDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MemberReportDO::getId));
    }

    @Select("select count(*) num from blind_member_report where no = #{reportNo}")
    Integer getMemberReportNo(@Param("reportNo") String reportNo);

}
